package com.hemerasolutions.v2trainer.model.exercise.volume;

import com.hemerasolutions.v2trainer.model.base.BaseModel;
import com.hemerasolutions.v2trainer.model.unit.volume.VolumeType;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;

@Entity
public class Volume extends BaseModel {
 
	private static final long serialVersionUID = 1L;

    @Column
    private float value;
	 
    @ManyToOne
    private VolumeType volumeType;
    

	public Volume() {
		super();
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public float getValue() {
		return value;
	}

	public VolumeType getVolumeType() {
		return volumeType;
	}

	public void setValue(float value) {
		this.value = value;
	}

	public void setVolumeType(VolumeType volumeType) {
		this.volumeType = volumeType;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + Float.floatToIntBits(value);
		result = prime * result
				+ ((volumeType == null) ? 0 : volumeType.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Volume other = (Volume) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (Float.floatToIntBits(value) != Float.floatToIntBits(other.value))
			return false;
		if (volumeType == null) {
			if (other.volumeType != null)
				return false;
		} else if (!volumeType.equals(other.volumeType))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Volume [id=" + id + ", value=" + value + ", volumeType="
				+ volumeType + "]";
	}



}
 
